/*
 * DA2Comm.java
 *
 * Created on 11 marzo 2007, 19.58
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package com.bloomingstars.bluepad.comm;

import java.io.InputStream;
import java.io.OutputStream;
import java.util.Vector;

/**
 *
 * @author vega
 */
public abstract class DA2Comm
{   
    /** Creates a new instance of DA2Comm */
    public DA2Comm()
    {
    }
    
    /**
     * @return <code>SetupStatus</code>
     */
    public abstract int setup(DA2Address addr); 
    
    /**
     * @return <code>ConnectionStatus</code>
     */
    public abstract int connect();
    
    /**
     * @return <code>TxStatus</code>
     */    
    public abstract int send(int cmd);
    
    public abstract void disconnect();
    
    public DA2Address getAddress()
    {
        return address;
    }
    
    public void addCommListener(DA2CommListener listener)
    {
        listeners.addElement(listener);
    }
    
    public void setSetupStatus(int st)
    {
        setupStatus = st;
    }

    public int getSetupStatus()
    {
        return setupStatus;
    }
    
    /** DA2 address */
    protected DA2Address address = new DA2Address();
    /** Input listener list */
    protected Vector listeners = new Vector();
    /** */
    protected InputStream in;
    /** */
    protected OutputStream out;   
    /** */
    protected int setupStatus = SetupStatus.SETUP_UNDEFINED;
    /** */
    protected int lastCommand = CommandCode.NULL_COMMAND;
    
}

 